const source = require('../sources/a.json')
const { downloadBook, parseBook } = require('../modules/book')

downloadBook(source, 'https://www.bqg5200.com/book/265/').then(res => {
  require('fs').writeFile(__dirname + '/../temp/book.html', res, function (err) {
    console.log(err)
  })
  const book = parseBook(source, res)
  require('fs').writeFile(__dirname + '/../temp/book.json', JSON.stringify(book), function (err) {

  })
})

// require('fs').readFile(__dirname + '/../temp/book.html', function (err, data) {
//   const book = parseBook(source, data.toString('utf8'))
//   console.log(book)
// })
